<!DOCTYPE html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>后台类别班次添加</title>
	<%@include file="common/head.jsp" %>
	<%@include file="common/loginstate.jsp" %>
	<link href="${staticPath}/css/css.css" type=text/css rel=stylesheet>
	<script type="text/javascript" src="${staticPath}/js/popup.js"></script>
	<script type="text/javascript">
		//文件上传
		function upx(id) {
			var pop=new Popup({ contentType:1,isReloadOnClose:false,width:400,height:200});
			pop.setContent("contentUrl","${contextPath}/common/upload/?id="+id);
			pop.setContent("title","文件上传");
			pop.build();
			pop.show();
		}
		// 添加班次
		function banciAdd() {
			var bianhao = $("#bianhao").length > 0 ? $('#bianhao').val().trim():null;
			if($("#bianhao").length > 0 && bianhao == "")
			{
				alert("please input:编号");
			    $('#bianhao').focus();
				return false;
			}
			var leibieid = $('#leibieid').val().trim();
			var qishizhan = $("#qishizhan").length > 0 ? $('#qishizhan').val().trim():null;
			if($("#qishizhan").length > 0 && qishizhan == "")
			{
				alert("please input:起始站");
			    $('#qishizhan').focus();
				return false;
			}
			var zhongdianzhan = $("#zhongdianzhan").length > 0 ? $('#zhongdianzhan').val().trim():null;
			if($("#zhongdianzhan").length > 0 && zhongdianzhan == "")
			{
				alert("please input:终点站");
			    $('#zhongdianzhan').focus();
				return false;
			}
			var qishishijian = $("#qishishijian").length > 0 ? $('#qishishijian').val().trim():null;
			if($("#qishishijian").length > 0 && qishishijian == "")
			{
				alert("please input:起始时间");
			    $('#qishishijian').focus();
				return false;
			}
			var daodashijian = $("#daodashijian").length > 0 ? $('#daodashijian').val().trim():null;
			if($("#daodashijian").length > 0 && daodashijian == "")
			{
				alert("please input:到达时间");
			    $('#daodashijian').focus();
				return false;
			}
			var riqi = $("#riqi").length > 0 ? $('#riqi').val().trim():null;
			if($("#riqi").length > 0 && riqi == "")
			{
				alert("please input:日期");
			    $('#riqi').focus();
				return false;
			}
			var jiage = $("#jiage").length > 0 ? $('#jiage').val().trim():null;
			if($("#jiage").length > 0 && jiage == "")
			{
				alert("please input:价格");
			    $('#jiage').focus();
				return false;
			}
			var shuliang = $("#shuliang").length > 0 ? $('#shuliang').val().trim():null;
			if($("#shuliang").length > 0 && shuliang == "")
			{
				alert("please input:票数");
			    $('#shuliang').focus();
				return false;
			}
			var beizhu = $("#beizhu").length > 0 ? $('#beizhu').val().trim():null;
			if($("#beizhu").length > 0 && beizhu == "")
			{
				alert("please input:备注");
			    $('#beizhu').focus();
				return false;
			}

			var param = {
				'bianhao':bianhao,
				'leibieid':leibieid,
				'qishizhan':qishizhan,
				'zhongdianzhan':zhongdianzhan,
				'qishishijian':qishishijian,
				'daodashijian':daodashijian,
				'riqi':riqi,
				'jiage':jiage,
				'shuliang':shuliang,
				'beizhu':beizhu,

			};
			$.ajax({
				type: 'post',
				url: '${basePath}/banciAddOrUpdate',
				dataType: "json",
				contentType:"application/json",
				data : JSON.stringify(param),
				success: function (resp) {
					if (resp.success) {
						alert("添加成功！");
						//window.location.href = "${contextPath}/banciMana";
					} else {
						alert(resp.message);
					}
				}
			});
		}
	</script>
</head>

<body leftmargin="2" topmargin="9" background='${staticPath}/img/allbg.gif'>
<form id="formAdd" name="formAdd" >
	<table width="98%" align="center" border="0" cellpadding="4" cellspacing="1" bgcolor="#CBD8AC" style="margin-bottom:8px">
		<tr bgcolor="#EEF4EA">
			<td colspan="3" background="${staticPath}/img/wbg.gif" class='title'><span>&nbsp;类别班次添加</span></td>
		</tr>
		<tr align='center' bgcolor="#FFFFFF" onMouseMove="javascript:this.bgColor='red';" onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22">
			<td width="10%" bgcolor="#FFFFFF" align="right">
				班次类别
			</td>
			<td width="90%" bgcolor="#FFFFFF" align="left">
				<select name="leibieid" id="leibieid" style="width: 280px;">
					<option value="${leibie.id}">${leibie.mingcheng}</option>
				</select>
			</td>
		</tr>
		<tr align='center' bgcolor="#FFFFFF" onMouseMove="javascript:this.bgColor='red';" onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22">
			<td width="20%" bgcolor="#FFFFFF" align="right">
				编号:
			</td>
            <td width="80%" bgcolor="#FFFFFF" align="left">
                <input type="text" name="bianhao" id="bianhao" size="70px"/>
            </td>

		</tr>
		<tr align='center' bgcolor="#FFFFFF" onMouseMove="javascript:this.bgColor='red';" onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22">
			<td width="20%" bgcolor="#FFFFFF" align="right">
				起始站:
			</td>
            <td width="80%" bgcolor="#FFFFFF" align="left">
                <input type="text" name="qishizhan" id="qishizhan" size="70px"/>
            </td>

		</tr>
		<tr align='center' bgcolor="#FFFFFF" onMouseMove="javascript:this.bgColor='red';" onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22">
			<td width="20%" bgcolor="#FFFFFF" align="right">
				终点站:
			</td>
            <td width="80%" bgcolor="#FFFFFF" align="left">
                <input type="text" name="zhongdianzhan" id="zhongdianzhan" size="70px"/>
            </td>

		</tr>
		<tr align='center' bgcolor="#FFFFFF" onMouseMove="javascript:this.bgColor='red';" onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22">
			<td width="20%" bgcolor="#FFFFFF" align="right">
				起始时间:
			</td>
            <td width="80%" bgcolor="#FFFFFF" align="left">
                <input type="text" name="qishishijian" id="qishishijian" style="border:1px solid #cccccc;" readonly="readonly" size="25px" value="<%=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())%>" />
            </td>

		</tr>
		<tr align='center' bgcolor="#FFFFFF" onMouseMove="javascript:this.bgColor='red';" onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22">
			<td width="20%" bgcolor="#FFFFFF" align="right">
				到达时间:
			</td>
            <td width="80%" bgcolor="#FFFFFF" align="left">
                <input type="text" name="daodashijian" id="daodashijian" style="border:1px solid #cccccc;" readonly="readonly" size="25px" value="<%=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())%>" />
            </td>

		</tr>
		<tr align='center' bgcolor="#FFFFFF" onMouseMove="javascript:this.bgColor='red';" onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22">
			<td width="20%" bgcolor="#FFFFFF" align="right">
				日期:
			</td>
            <td width="80%" bgcolor="#FFFFFF" align="left">
                <input type="text" name="riqi" id="riqi" style="border:1px solid #cccccc;" class="Wdate" onfocus="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd'})" onClick="WdatePicker({'dateFmt':'yyyy-MM-dd'})" size="15px" value="<%=new SimpleDateFormat("yyyy-MM-dd").format(new Date())%>" />
            </td>

		</tr>
		<tr align='center' bgcolor="#FFFFFF" onMouseMove="javascript:this.bgColor='red';" onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22">
			<td width="20%" bgcolor="#FFFFFF" align="right">
				价格:
			</td>
            <td width="80%" bgcolor="#FFFFFF" align="left">
                <input type="number" name="jiage" id="jiage" value="0" size="70px"/>
            </td>

		</tr>
		<tr align='center' bgcolor="#FFFFFF" onMouseMove="javascript:this.bgColor='red';" onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22">
			<td width="20%" bgcolor="#FFFFFF" align="right">
				票数:
			</td>
            <td width="80%" bgcolor="#FFFFFF" align="left">
                <input type="number" name="shuliang" id="shuliang" value="0" size="70px"/>
            </td>

		</tr>
		<tr align='center' bgcolor="#FFFFFF" onMouseMove="javascript:this.bgColor='red';" onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22">
			<td width="20%" bgcolor="#FFFFFF" align="right">
				备注:
			</td>
            <td width="80%" bgcolor="#FFFFFF" align="left">
                <input type="text" name="beizhu" id="beizhu" size="70px"/>
            </td>

		</tr>

		<tr align='center' bgcolor="#FFFFFF" height="22">
			<td width="10" bgcolor="#FFFFFF" align="right">&nbsp;</td>
			<td width="90%" bgcolor="#FFFFFF" align="left">
				<input type="button" name="Submit" value="提交" style='border:solid 1px #000000; color:#666666' onclick="banciAdd();"/>
				<input type="button" value="返回" style='border:solid 1px #000000; color:#666666' onClick="javascript:history.back()" />
				<input type="reset" name="Submit2" value="重置" style='border:solid 1px #000000; color:#666666'/></td>
		</tr>
	</table>
</form>
</body>
</html>
